﻿-- Examples for queries that exercise different SQL objects implemented by this assembly

-----------------------------------------------------------------------------------------
-- Stored procedure
-----------------------------------------------------------------------------------------
-- exec StoredProcedureName


-----------------------------------------------------------------------------------------
-- User defined function
-----------------------------------------------------------------------------------------
-- select dbo.FunctionName()


-----------------------------------------------------------------------------------------
-- User defined type
-----------------------------------------------------------------------------------------
-- CREATE TABLE test_table (col1 UserType)
--
-- INSERT INTO test_table VALUES (convert(uri, 'Instantiation String 1'))
-- INSERT INTO test_table VALUES (convert(uri, 'Instantiation String 2'))
-- INSERT INTO test_table VALUES (convert(uri, 'Instantiation String 3'))
--
-- select col1::method1() from test_table



-----------------------------------------------------------------------------------------
-- User defined type
-----------------------------------------------------------------------------------------
-- select dbo.AggregateName(Column1) from Table1


USE [DataCenter]

EXEC	[dbo].[DropValue]
		@ObjectId = N'1',
		@ValueType = N'1',
		@StartTime = N'2011-3-1',
		@EndTime = N'2011-3-1'

--EXEC	[dbo].[QueryScadaValue]
--		@TableName = N'TBL_SCADA',
--		@ObjectId = N'1',
--		@ValueType = NULL,
--		@OperType = NULL,
--		@StartTime = N'2011-11-1',
--		@EndTime = N'2011-11-2',
--		@Step = 1,
--		@PullData = 1

--EXEC	[dbo].[ImportValue]
--		@ObjectId = N'1',
--		@StartTime = N'2010-12-1',
--		@EndTime = N'2010-12-30'

--EXEC	[dbo].[QueryLastValue]
--		@ObjectId = N'1',
--		@ValueType = N'1'

--select * from dbo.SelectRecentValue(N'1,2',nULL)

--EXEC	[dbo].[InsertValue]
--		@ObjectId = 1,
--		@ValueType = 1,
--		@OperType = 2,
--		@ValueTime = N'2010-12-8 1:00:00',
--		@Value = 10.0

--EXEC	[dbo].[InsertValue]
--		@ObjectId = 1,
--		@ValueType = 1,
--		@OperType = 2,
--		@ValueTime = N'2010-12-8 1:00:00',
--		@Fields = N'R__0,1'


--EXEC	[dbo].[InsertValue]
--		@ObjectId = 1,
--		@ValueType = 1,
--		@OperType = 2,
--		@ValueTime = N'2010-12-8 12:00:00',
--		@Fields = N'R__0,1'

--EXEC	[dbo].[QueryValue]
--		@ObjectId = N'1',
--		@ValueType = NULL,
--		@OperType = NULL,
--		@StartTime = N'2010-1-1 0:00:00',
--		@EndTime = N'2010-1-2 0:00:00',
--		@Step = 7,
--		@ImportValue = 0

--SELECT * FROM [dbo].[QueryValue1](N'1', NULL, NULL, N'2010-1-1 0:00:00', N'2010-3-2 0:00:00', 1, 0)

--EXEC	[dbo].[AggregateValue]
--		@ObjectId = NULL,
--		@ValueType = NULL,
--		@OperType = NULL,
--		@StartTime = NULL,
--		@EndTime = NULL,
--		@Step = NULL,
--		@GroupStyle = 'GroupByIdAndInterval',
--		@AggregateStyle = N'MIN,R__0,MAX,R__0,COUNT,R__0,AVG,R__0,SUM,R__0',
--		@Parameters = N'Interval,5'

--EXEC	[dbo].[DropValue]
--		@ObjectId = N'1',
--		@ValueType = N'1',
--		@StartTime = N'2009-1-3 1:00:00',
--		@EndTime = N'2009-10-5 10:00:00'